{{define "Title"}}组件设置{{end}}
{{define "Content"}}

<script type=text/javascript src="/js/enterKey.js"></script>
<script type=text/javascript src="/js/tablestyle.js"></script>

<div class="container-fluid">
<form class="form-horizontal" action="/setpart" method="POST">
  <fieldset>
    <legend><b>组件设置</b></legend>
    {{if .error}}<div class="alert alert-error"><b>错误: </b>{{.error | html}}</div>
    {{else }}
      {{if .flash}}<div class="alert alert-success"><b>提示: </b>{{.flash | html}}</div>{{end}}
    {{end}}
    <div class="control-group">
      <label class="control-label">物料&nbsp;</label>
      <div class="control">
        <select id="item" name="item" style="background-color:#FFFFD0" onkeydown="clicka();" onmousewheel="return false">
          <option value="">
          {{range .items}}
            <option value="{{.Item | html}}">{{.Item | html}}  |  {{.Desc | html}}
          {{end}}
        </select> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">站点&nbsp;</label>
      <div class="control">
        <select id="station" name="station" style="background-color:#FFFFD0" onkeydown="clicka();" onmousewheel="return false">
          <option value="">
          {{range .stations}}
            <option value="{{.Name | html}}">{{.Name | html}}
          {{end}}
        </select> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">组件名称&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="partname" name="partname" style="background-color: #FFFFD0" onkeydown="clicka();" maxlength="50"> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">组件描述&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="desc" name="desc" onkeydown="clicka();" maxlength="50">
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">组件条码&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="barcode" name="barcode" onkeydown="clicka();" maxlength="50"> <b style="color: red">('#': 字母, '$': 数字, '&': 字母或数字)</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">条码长度&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="leng" name="leng" onkeydown="clicka();">
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">组件数量&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="qty" name="qty" value="1">
      </div>
    </div>
    <div class="form-actions">
      <button type="submit" class="btn btn-primary">组件设置</button>
    </div>
  </fieldset>
</form>
</div>

{{if .parts}}
<div class="content-box">
  <div class="content-box-header">
    <p style="font-size: 16px;">&nbsp;&nbsp;<b>组件明细</b></p>
  </div>
  <div class="content-box-content">
    <table id="tbl_ls" border="1" cellspacing="0" cellpadding="0">
      <thead>
        <tr>
          <th>索引</th>
          <th>物料</th>
          <th>站点</th>
          <th>名称</th>
          <th>条码</th>
          <th>长度</th>
          <th>数量</th>
          <th>操作</th>
        </tr>  
      </thead>    
      
      <tbody>
        {{range .parts}}
        <tr>
          <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" align="center">{{.Index | html}}</td>
          <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" align="center">{{.Item | html}}</td>
          <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Station | html}}</td>
          <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Name | html}}</td>
          <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Barcode | html}}</td>
          <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Leng | html}}</td>
          <td fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px">{{.Qty | html}}</td>
          <td fieldset id="delpart" style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px"><a href="/_delpart?im={{.Item | html}}&st={{.Station | html}}">删除</a></td>
        </tr>
        {{end}}
      </tbody>
      
    </table>
  </div>
</div>

{{end}}

{{end}}